import request from './httpConfig/request'

/*登录*/
export function loginByUsername(username,password) {

  return request({
    url: 'ss/test.html',
    method: 'post',
    data:{
      "username":username,
      "password":password
    }
  })
}

/*退出*/
export function logout() {
  return request({
    url: '/login/logout',
    method: 'post'
  })
}

/*学生选课*/
export function StuChoice(couid,stuid) {
  return request({
    url: 'ss/StuChoice.html',
    method: 'get',

    params: {
      "CouId":couid,
      "StuId":stuid,
    }
  })
}

export function StuDeleCou(StuId,CouId) {
  return request({
    url: '/ss/StuDeleCou.html',
    method: 'get',
    params: {
      "StuId":StuId,
      "CouId":CouId,
    }
  })
}

/*学生已选课表数据*/
export function UpStuCou(StuId) {
  return request({
    url: '/ss/UpStuCou.html',
    method: 'get',
    params: {
      "StuId":StuId,
    }
  })
}


/*获取学生列表*/
export function getStuList(pageCode,pageSize) {
  return request({
    url: '/ss/stuList.html',
    method: 'get',
    params:{
      "pageCode":pageCode,
      "pageSize":pageSize
    }
  })
}

/*增加学生*/
export function addStuden(name,age,sex) {
  return request({
    url: '/ss/addStu.html',
    method: 'get',
    params:{
      "StuName":name,
      "StuAge":age,
      "StuSex":sex
    }
  })
}


/*课程列表*/
export function getCouList(StuId,pageCode,pageSize) {
  return request({
    url: '/ss/couList.html',
    method: 'get',
    params: {
      "StuId": StuId,
      "pageCode": pageCode,
      "pageSize": pageSize
    }
  })
}

/*课程列表*/
export function deleteStu(StuId) {
  return request({
    url: '/ss/deleteStu.html',
    method: 'get',
    params: {
      "StuId": StuId,
    }
  })
}

/*模糊查询学生*/
export function findLikeStus(content,pageCode,pageSize) {
  return request({
    url: '/ss/findLikeStus.html',
    method: 'get',
    params: {
      "content": content,
      "pageCode": pageCode,
      "pageSize": pageSize
    }
  })
}

/*保存覆盖物坐标*/
export function saveCover(cover,color,name,area,state) {
  return request({
    url: '/map/saveCover.html',
    method: 'post',
/*    params:{
      "Cover": cover,
    },*/
    data: {
      "Cover":JSON.stringify(cover),//后端用@RequestBody注解接收数据，这里必须用JSON.stringify()转换，避免四舍五入
      "color": color,   //颜色不需要转义，否则会连“”也插入数据库，取出来用的时候麻烦
      "name": name,
      "area": area,
      "state": state,
    }
  })
}

/*获取所有覆盖物*/
export function getAllCover() {
  return request({
    url: '/map/getAllCover.html',
    method: 'post',
    params: {

    }
  })
}

/*获取一个覆盖物*/
export function getOneCover(Coveroord) {
  return request({
    url: '/map/getOneCover.html',
    method: 'post',
    data: {
      "Coveroord": JSON.stringify(Coveroord),
     // "Coveroord": Coveroord,
    }
  })
}

/*删除一个覆盖物*/
export function deleOneCover(Coveroord) {
  return request({
    url: '/map/deleOneCover.html',
    method: 'post',
    data: {
      "Coveroord": JSON.stringify(Coveroord),
      // "Coveroord": Coveroord,
    }
  })
}



